package com.cetccloud.ap.config.handler;

import cn.hutool.core.map.MapUtil;
import com.cetccloud.ap.controller.model.ApiResult;
import com.cetccloud.ap.controller.model.req.HttpReq;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.server.reactive.ServerHttpRequest;
import org.springframework.http.server.reactive.ServerHttpResponse;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import reactor.core.publisher.Mono;

/**
 * @ClassName ZController
 * @Description TODO
 * @Author superz
 * @Date 2021/4/9 22:10
 * @Version 1.0
 **/
@Slf4j
@Controller
public class TestHandlerController {

    public Mono<Object> rest1(@RequestBody HttpReq httpReq, ServerHttpRequest request, ServerHttpResponse response) {
        log.info("rest1: " + httpReq);
        // 发起跨域请求
        return Mono.create(sink -> sink.success(ApiResult.success().build(MapUtil.of(1, "rest1"))));
    }
}
